/**
 * Project Name: jxcommons
 * Package Name: org.jxcommons.utils
 * created on 22.11.2012 by jkonopka
 */
package org.jenkon.commons.lang.utils;

/**
 * class with many util and helping methods for {@link String} handling.<br>
 * 
 * @author Jens Konopka
 * 
 */
public final class StringUtils {

	/**
	 * hide public constructor for this util class.<br>
	 */
	private StringUtils() {
	}

	/**
	 * check the {@link String} of is empty.
	 * 
	 * <pre>
	 * null	= true
	 * ""	= true
	 * "  "	= false
	 * "a "	= false
	 * " a"	= false
	 * </pre>
	 * 
	 * @param value the {@link String} to check of is empty
	 * @return true or false
	 */
	public static boolean isEmpty(final String value) {
		return value == null ? true : value.isEmpty();
	}

	/**
	 * trim the {@link String}.
	 * 
	 * <pre>
	 * <code>null return null</code>
	 * <code>""	return ""</code>
	 * <code>"   "	return ""</code>
	 * <code>" a "	return "a"</code>
	 * <code>" a"	return "a"</code>
	 * <code>"a "	return "a"</code>
	 * </pre>
	 * 
	 * @param value the {@link String} to trim
	 * @return the trimed {@link String}
	 */
	public static String trim(final String value) {
		return value == null ? null : value.trim();
	}

}
